﻿using System;
public class arr
{
    public static int getMax(int[]a)
    {
        int max = int.MinValue;
        for (int i = 0; i < a.Length; i++)
        {
            if (a[i] > max) { max = a[i]; }
        }
        return max;
    }
    public static int getMin(int[]a) {
        int min = int.MaxValue;
        for (int i = 0; i < a.Length; i++)
        {
            if (a[i] <min) { min = a[i]; }
        }
        return min;
    }
    public static double getSum(int[] a)
    {
        double sum = 0;
        for (int i = 0; i < a.Length; i++)
        {
            sum+= a[i];
        }
        return sum;
    }

    public static double getAvg(int[] a)
    {
        return getSum(a)/a.Length;
    }

    public static void Main(string[] args)
    {
        Console.WriteLine("请输入数组的大小");
        int n=int.Parse(Console.ReadLine());
        int[]a = new int[n];
        for(int i = 0; i < n; i++) {
            Console.WriteLine("请输入元素{0}", i);
            a[i]= int.Parse(Console.ReadLine());
        }
        Console.WriteLine("最大值为：{0}，最小值为：{1}，总和为：{2}，平均值为：{3}", getMax(a), getMin(a), getSum(a), getAvg(a));

    }
}